var liveBox = 0;
function createBox(text,btOK) {
	if(liveBox != 1){
		var newDiv = document.createElement('div');
		newDiv.setAttribute("id", "BigBox");
		newDiv.setAttribute("class", "BigBox");
		htmlText ='\n<div class="TopText"><p>'+text+'</p></div>\n';
		htmlText = htmlText.concat('<div class="loginLine">\n<div class="loginButton">');
		htmlText = htmlText.concat('<input type="button" class="loginSubmit" onclick="destroyBox(\'BigBox\')" id="submitButton" value="'+btOK+'" />\n');
		htmlText = htmlText.concat('</div>\n</div>\n');
		newDiv.innerHTML = htmlText;
		parent.document.getElementsByTagName("body")[0].appendChild(newDiv);
		parent.document.getElementById('submitButton').focus();
		liveBox = 1;
	}
}
function destroyBox(id) {
	parent.document.getElementById('sysUsr').value = '';
	parent.document.getElementById('sysPwd').value = '';
	document.getElementsByTagName("body")[0].removeChild(document.getElementById(id));
	document.getElementById('sysUsr').focus();
	liveBox = 0;
}
function loginAPMS(lVoid,lOk){
	if(document.getElementById('sysUsr').value != '' && document.getElementById('sysPwd').value != ''){
		document.getElementById('sysPwd').value = hex_md5(document.getElementById('sysPwd').value);
		var newObject = document.createElement('iframe');
		newObject.setAttribute("id", "apmsSubmit");
		newObject.setAttribute("name", "apmsSubmit");
		document.getElementsByTagName("body")[0].appendChild(newObject);
		return true;
	} else {
		createBox(lVoid,lOk);
		return false;
	}
}